/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "COMITE", catalog = "", schema = "PROYECTO")
@NamedQueries({
    @NamedQuery(name = "Comite.findAll", query = "SELECT c FROM Comite c"),
    @NamedQuery(name = "Comite.findByCodigocomite", query = "SELECT c FROM Comite c WHERE c.codigocomite = :codigocomite"),
    @NamedQuery(name = "Comite.findByContrasenia", query = "SELECT c FROM Comite c WHERE c.contrasenia = :contrasenia"),
    @NamedQuery(name = "Comite.findByNombre", query = "SELECT c FROM Comite c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Comite.findByDescripcion", query = "SELECT c FROM Comite c WHERE c.descripcion = :descripcion")})
public class Comite implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CODIGOCOMITE", nullable = false)
    private Integer codigocomite;
    @Basic(optional = false)
    @Column(name = "CONTRASENIA", nullable = false, length = 20)
    private String contrasenia;
    @Basic(optional = false)
    @Column(name = "NOMBRE", nullable = false, length = 100)
    private String nombre;
    @Column(name = "DESCRIPCION", length = 350)
    private String descripcion;
    @JoinColumn(name = "CODIGOPROYECTO", referencedColumnName = "CODIGOCONGRESO", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Proyecto proyecto;
    @OneToMany(mappedBy = "comite", fetch = FetchType.EAGER)
    private List<Comite> comiteList;
    @JoinColumn(name = "COMITEPADRE", referencedColumnName = "CODIGOCOMITE")
    @ManyToOne(fetch = FetchType.EAGER)
    private Comite comite;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comite", fetch = FetchType.EAGER)
    private List<Carta> cartaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comite", fetch = FetchType.EAGER)
    private List<Evento> eventoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "comite", fetch = FetchType.EAGER)
    private List<Responsabilidadescomite> responsabilidadescomiteList;
    @OneToMany(mappedBy = "comite", fetch = FetchType.EAGER)
    private List<Actividades> actividadesList;

    public Comite() {
    }

    public Comite(Integer codigocomite) {
        this.codigocomite = codigocomite;
    }

    public Comite(Integer codigocomite, String contrasenia, String nombre) {
        this.codigocomite = codigocomite;
        this.contrasenia = contrasenia;
        this.nombre = nombre;
    }

    public Integer getCodigocomite() {
        return codigocomite;
    }

    public void setCodigocomite(Integer codigocomite) {
        this.codigocomite = codigocomite;
    }

    public String getContrasenia() {
        return contrasenia;
    }

    public void setContrasenia(String contrasenia) {
        this.contrasenia = contrasenia;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Proyecto getProyecto() {
        return proyecto;
    }

    public void setProyecto(Proyecto proyecto) {
        this.proyecto = proyecto;
    }

    public List<Comite> getComiteList() {
        return comiteList;
    }

    public void setComiteList(List<Comite> comiteList) {
        this.comiteList = comiteList;
    }

    public Comite getComite() {
        return comite;
    }

    public void setComite(Comite comite) {
        this.comite = comite;
    }

    public List<Carta> getCartaList() {
        return cartaList;
    }

    public void setCartaList(List<Carta> cartaList) {
        this.cartaList = cartaList;
    }

    public List<Evento> getEventoList() {
        return eventoList;
    }

    public void setEventoList(List<Evento> eventoList) {
        this.eventoList = eventoList;
    }

    public List<Responsabilidadescomite> getResponsabilidadescomiteList() {
        return responsabilidadescomiteList;
    }

    public void setResponsabilidadescomiteList(List<Responsabilidadescomite> responsabilidadescomiteList) {
        this.responsabilidadescomiteList = responsabilidadescomiteList;
    }

    public List<Actividades> getActividadesList() {
        return actividadesList;
    }

    public void setActividadesList(List<Actividades> actividadesList) {
        this.actividadesList = actividadesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigocomite != null ? codigocomite.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Comite)) {
            return false;
        }
        Comite other = (Comite) object;
        if ((this.codigocomite == null && other.codigocomite != null) || (this.codigocomite != null && !this.codigocomite.equals(other.codigocomite))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Comite[codigocomite=" + codigocomite + "]";
    }

}
